/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.tools;

import com.hankcs.hanlp.HanLP;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Austin
 */
public class KeyWordTools {

    public static String KeyWordTools(String cont) {
        String keyWord = "";
        List<String> keywordList = HanLP.extractKeyword(cont, 50);
        if (keywordList.size() > 10) {
            for (int i = 0; i < 10; i++) {
                keyWord = keyWord + keywordList.get(i);
            }
        } else {
            for (int i = 0; i < keywordList.size(); i++) {
                keyWord = keyWord + keywordList.get(i);
            }
        }
        return keyWord;
    }

    public static void main(String[] args) {
        //fb5817b5a1d4fead5abd6b9bef36d460
        ArrayList<String> list = JSoupParserHtml.getPicSrcFromHTML("出租枫水湾楼房，两室一厅，86平米，四楼。电话15022387789");
        String[] strs;
        strs = new String[list.size() + 1];
        strs[0] = "";
        int idx = 0;
        for (String ss : list) {
            strs[++idx] = ss;
        }

        //生成attachment_url的字段
        String att = "";
        for (int i = 0; i < strs.length; ++i) {
            att = att + "," + strs[i];
        }
        //76a563fcd8b4b70777cc921e23139ac708e3449ab6728f942b0363de83c5c31d
        String cont = "出租枫水湾楼房，两室一厅，86平米，四楼。电话15022387789";
        System.out.println(KeyWordTools.KeyWordTools(cont));
        System.out.println(GenerateMD5.string2MD5(","+cont));

    }
}
